const { ccclass, property } = cc._decorator;

import n from "./EventMgr";
import l from "./GameEventType";
import c from "./ClientData";
import u from "./SystemConfig";

@ccclass
export default class AboutNodeCtrl extends cc.Component {
    @property(cc.Label)
    label_game_name: cc.Label = null;

    @property(cc.Label)
    label_version: cc.Label = null;

    @property(cc.Label)
    label_app_version: cc.Label = null;

    @property(cc.Label)
    label_channel: cc.Label = null;

    onLoad() {
        n.listen(l.SHOW_XIAOMI_SURFACE_ABOUT, this.clickAboutUs, this);
    };

    start() {};

    init() {};

    onDestroy() {
        n.ignore(l.SHOW_XIAOMI_SURFACE_ABOUT, this.clickAboutUs, this);
    };

    clickAboutUs() {
        this.node.active = true;
        this.label_game_name.getComponent(cc.Label).string = u.GAME_NAME;
        // this.label_version.getComponent(cc.Label).string = "V" + s.getInstance().getVersion();
        // this.label_app_version.getComponent(cc.Label).string = c.version_name || "";
        // this.label_channel.getComponent(cc.Label).string = c.channel_name || "";
    };

    closeAboutUs() {
        this.node.active = false;
    };
}
